package com.wsoft.constant;

/**
 * redis常量
 *
 * @author: juiet
 * @date: 2024年09月03日 10:55
 */
public class RedisKeyConstant {
    /**
     * 固定key类型
     */
    public static final String REDIS_NULL = "REDIS_NULL";
    public static final String REDIS_SELF = "REDIS_SELF";
    public static final String REDIS_PATTERN = "REDIS_PATTERN";

    /**
     * redis 通配符
     */
    public static final String PATTERN_SYMBOL="*";
    /**
     * 验证码缓存key + 验证码标识
     */
    public static final String VERIFICATION_CODE = "VERIFICATION_CODE:";
    /**
     * 用户登录次数缓存key + 用户名
     */
    public static final String LOGIN_USER_COUNT = "LOGIN_USER_COUNT:";
    /**
     * 用户登录缓存key + 用户名
     */
    public static final String USER_INFO_CACHE = "USER_INFO_CACHE:";
    public static final String CACHE_TYPE_ALL_DEPT = "CACHE_TYPE_ALL_DEPT";

    public static final String ORG_CACHE = "ORG_CACHE:";

    public static final String ORG_TREE_CACHE = "ORG_TREE_CACHE";


    /**
     * 字典缓存key +字典编码
     */
    public static final String DICT_CACHE = "DICT_CACHE:";

    public static final String DICT_CACHE_ALL = "DICT_CACHE_ALL";

    public static final String CONFIG_CACHE_ALL = "CONFIG_CACHE_ALL";


    public static final String DATA_PERM_ALL = "DATA_PERM_ALL";

    public static final String MODEL_DATA_CACHE_KEY_TEMPLATE = "ModelDataCache:{}:{}";
    public static final String MODEL_DATA_CACHE_KEY_FIND_BY_ID = "ModelDataCache:{}*";

    public static final String DATA_PERM = "DATA_PERM:";

    public static final String DEFAULT_DATA_PERM = "DEFAULT_DATA_PERM";

    public static final String MEMBER_DATA_PERM = "MEMBER_DATA_PERM:";

    public static final String POST_CACHE = "POST_CACHE:";

    public static final String POST_ALL_CACHE = "POST_All_CACHE";

    public static final String LEVEL_CACHE = "LEVEL_CACHE:";
    public static final String CONFIG_INFO = "CONFIG_INFO";

    public static final String CONFIG_INFO_ORG = "CONFIG_INFO_ORG:";

    public static final String CONFIG_INFO_MEMBER = "CONFIG_INFO_MEMBER:";


    public static final String MENU_TREE_ALL = "MENU_TREE_ALL";

    public static final String MENU_CACHE = "MENU_CACHE:";

    public static final String ROLE_DATA_PERM_CACHE = "ROLE_DATA_PERM_CACHE:";

    public static final String ROLE_MENU_CACHE = "ROLE_MENU_CACHE:";

    public static final String MEMBER_CACHE = "MEMBER_CACHE:";

    public static final String MEMBER_ROLE_CACHE = "MEMBER_ROLE_CACHE:";

    public static final String MEMBER_POST_CACHE = "MEMBER_POST_CACHE:";

    /**
     * 自定义表单 redis key
     */
    public static class Form {

        /**
         * 自定义表单默认过期时间
         */
        public static final String EXPIRED = "604800";

        /**
         * 自定义表单前缀
         */
        private static final String FORM = "FORM:";

        //############################# form  ##############################
        public static final String FORM_PREFIX = FORM + "FORM:";

        /**
         * key:formCode
         * value:form
         */
        public static final String FORM_CODE = FORM_PREFIX + "CODE:";
        /**
         * key:formId
         * value:formEntity
         */
        public static final String FORM_INFO = FORM_PREFIX + "INFO:";


        //############################# table  ##############################
        /**
         * table前缀
         */
        public static final String TABLE_PREFIX = FORM + "TABLE:";
        /**
         * key:formId
         * value:tableList
         */
        public static final String TABLE_LIST = TABLE_PREFIX + "LIST:";
        /**
         * key:tableId
         * value:tableEntity
         */
        public static final String TABLE_INFO = TABLE_PREFIX + "INFO:";

        //############################# column  ##############################
        /**
         * column 前缀
         */
        public static final String COLUMN_PREFIX = FORM + "COLUMN:";
        /**
         * key:tableId
         * value:columnList
         */
        public static final String COLUMN_LIST = COLUMN_PREFIX + "LIST:";
        /**
         * key:columnId
         * value:columnEntity
         */
        public static final String COLUMN_INFO = COLUMN_PREFIX + "INFO:";

        //############################# design  ##############################
        /**
         * design 前缀
         */
        public static final String DESIGN_PREFIX = FORM + "DESIGN:";
        /**
         * key:formId
         * value:designList
         */
        public static final String DESIGN_LIST = DESIGN_PREFIX + "LIST:";
        /**
         * key:designId
         * value:designEntity
         */
        public static final String DESIGN_INFO = DESIGN_PREFIX + "INFO:";


        //############################# virtualColumn  ##############################
        /**
         * virtualColumn 前缀
         */
        public static final String VIRTUAL_COLUMN_PREFIX = FORM + "VIRTUAL:";
        /**
         * key:table
         * value:virtualColumnList
         */
        public static final String VIRTUAL_COLUMN_LIST = VIRTUAL_COLUMN_PREFIX + "LIST:";
        /**
         * key:id
         * value:virtualColumnEntity
         */
        public static final String VIRTUAL_COLUMN_INFO = VIRTUAL_COLUMN_PREFIX + "INFO:";

        //############################# tableRelation  ##############################
        /**
         * tableRElation 前缀
         */
        public static final String TABLE_RELATION_PREFIX = FORM + "RELATION:";
        /**
         * key:formId
         * value:tableRelationList
         */
        public static final String TABLE_RELATION_LIST = TABLE_RELATION_PREFIX + "LIST:";
        /**
         * key:id
         * value:tableRelationEntity
         */
        public static final String TABLE_RELATION_INFO = TABLE_RELATION_PREFIX + "INFO:";


        //############################# link  ##############################
        /**
         * link 前缀
         */
        public static final String LINK_PREFIX = FORM + "LINK:";
        /**
         * key:id
         * value:linkEntity
         */
        public static final String LINK_INFO = LINK_PREFIX + "INFO:";


    }

    /**
     * 附件服务器 redis key
     */
    public static class Oss {
        /**
         * 文件上传默认过期时间 单位秒 86400 = 1day
         */
        public static final long EXPIRED = 86400;

        /**
         * 文件上传
         */
        private static final String OSS = "OSS:";
        /**
         * 已上传part index
         */
        public static final String OSS_PART_INDEX = OSS + "PART:MD5:";
        /**
         * 已上传part fileName
         */
        public static final String OSS_FILE_NAME = OSS + "FILENAME:MD5:";
        /**
         * 已上传文件大小
         */
        public static final String OSS_FILE_SIZE = OSS + "FILESIZE:MD5:";
    }

    /**
     * 自定义规则 redis key
     */
    public static class Rule{
        /**
         * 自定义规则默认过期时间 单位秒 86400 = 1day
         */
        public static final long EXPIRED = 86400;

        /**
         * 自定义规则
         */
        private static final String RULE = "RULE:";

        /**
         * 规则code
         * key: code
         * value : ruleEntity
         */
        public static final String RULE_CODE = RULE + "CODE:";
        /**
         * 规则id
         * key: id
         * value : ruleEntity
         */
        public static final String RULE_ID = RULE + "ID:";
    }

    /**
     * 任务调度 redis key
     */
    public static class Job{
        /**
         * 任务调度默认过期时间 单位秒 86400 = 1day
         */
        public static final String EXPIRED = "86400";

        /**
         * 自定义规则
         */
        private static final String JOB = "JOB:";

        /**
         * 任务调度code
         * key: code
         * value : jobEntity
         */
        public static final String JOB_CODE = JOB + "CODE:";
        /**
         * 任务调度id
         * key: id
         * value : jobEntity
         */
        public static final String JOB_ID = JOB + "ID:";
    }
}
